//
//  XHVisitorTableViewController.swift
//  XHWeibo
//
//  Created by craneteng on 16/5/15.
//  Copyright © 2016年 XHTeng. All rights reserved.
//

import UIKit

class XHVisitorTableViewController: UITableViewController {
    // 判断用户是否登陆
    private var userLogin = false
    
    // 加载访客视图
   lazy var visitorView:XHVisitorView? = XHVisitorView()
    
    func setupVisitorView() {
        view = visitorView
        visitorView?.delegate = self
    }
    
    // 登陆逻辑判断
    override func loadView() {
        // 如果登陆了 就调用父视图的loadView
        userLogin ? super.loadView() : setupVisitorView()
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false
        
        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    // MARK: - Table view data source
    
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 0
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return 0
    }
}

// MARK: - 注册登陆按钮点击的代理方法实现
extension XHVisitorTableViewController : XHVisitorDelegate {

    func didClickRegisterButton() {
        print("点击了注册按钮")
    }
    
    func didClickLoginButton() {
        print("点击了登陆按钮")
    }

}
